package com.ctshk.rpc.tour.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ctshk.rpc.tour.dto.cache.TripCustomCostDTO;
import com.ctshk.rpc.tour.entity.SeriesTripCustomCost;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 成本分摊自定义 Mapper 接口
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-01-18
 */
public interface SeriesTripCustomCostMapper extends BaseMapper<SeriesTripCustomCost> {

    @Select({"<script>",
            "SELECT cc.trip_id,sp.group_customer_price ",
            "from t_series_trip_custom_cost cc , t_series_trip_custom_sale_price sp ",
            "WHERE cc.id = sp.cost_id ",
            "and cc.is_deleted = #{isDelete}",
            "and sp.group_customer_price > 0",
            "and cc.trip_id in ",
            "<foreach collection='tripIds' item='id' open='(' separator=',' close=')'>",
            "#{id}",
            "</foreach>",
            "</script>"})
    List<TripCustomCostDTO> queryTripCustomCost(@Param("tripIds") Set<Long> tripIds, @Param("isDelete") Integer isDelete);
}
